home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / dimlib10 / cdemo.cpp next >
C/C++ Source or Header  |  1995-10-31  |  1KB  |  71 lines

  1. #define STRICT
  2. #define WIN31
  3. #include <windows.h>
  4. #include <windowsx.h>
  5. #include "dimlib.h"
  6. #include "cdemo.h"
  7.  
  8. HINSTANCE hInst;
  9.  
  10. void DimShowMsg(HWND hWnd, char *msg)
  11. {
  12.     DimWindow(hWnd);
  13.     MessageBox(hWnd, msg, "DimLib Demo", MB_OK | MB_ICONINFORMATION);
  14.     UnDimWindow(hWnd);
  15. }
  16.  
  17. //    DlgProc is used by both dialog boxes.
  18. BOOL _export CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM)
  19. {
  20.     switch (msg) {
  21.         case WM_INITDIALOG:
  22.             {
  23.             HWND chkHWnd = GetDlgItem(hWnd, DIMCHECK);
  24.             if (chkHWnd)
  25.                 Button_SetCheck(chkHWnd, TRUE);
  26.             }
  27.             return TRUE;
  28.  
  29.         case WM_COMMAND:
  30.             switch (wParam) {
  31.                 case TRYME:
  32.                     DimWindow(hWnd);
  33.                     DialogBox(hInst, "DIALOG2", hWnd, DlgProc);
  34.                     UnDimWindow(hWnd);
  35.                     break;
  36.  
  37.                 case TRYMETOO:
  38.                     DimShowMsg(hWnd, "I knew you could do it!");
  39.                     break;
  40.  
  41.                 case IDOK:
  42.                 case IDCANCEL:
  43.                     EndDialog(hWnd, 0);
  44.                     break;
  45.  
  46.                 case IDYES:
  47.                     DimShowMsg(hWnd, "Thanks!");
  48.                     EndDialog(hWnd, 0);
  49.                     break;
  50.  
  51.                 case IDNO:
  52.                     DimShowMsg(hWnd, "Bummer!");
  53.                     EndDialog(hWnd, 0);
  54.                     break;
  55.  
  56.                 case DIMCHECK:
  57.                     EnableDim(Button_GetCheck(GetDlgItem(hWnd, DIMCHECK)));
  58.                     break;
  59.             }
  60.             return TRUE;
  61.     }
  62.     return FALSE;
  63. }
  64.  
  65. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
  66. {
  67.     hInst = hInstance;
  68.  
  69.     DialogBox(hInst, "DIALOG1", 0, DlgProc);
  70.     return 0;
  71. }